package test3;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Administrator implements ActionListener {
    JFrame j;
    JPanel p, p1;
    JButton b1, b2, b3, b4;
    JLabel l;
    String str;

    public Administrator() {
        j = new JFrame("管理员");
        p = new JPanel();
        j.setBounds(800, 200, 300, 200);
        p1 = new JPanel(new GridLayout(4, 1));
        b1 = new JButton("删除记录");
        b2 = new JButton("登陆记录");
        b3 = new JButton("删除登陆记录");
        b4 = new JButton("接收反馈记录");
        b1.addActionListener(this);
        b2.addActionListener(this);
        b3.addActionListener(this);
        b4.addActionListener(this);
        p1.add(b1);
        p1.add(b2);
        p1.add(b3);
        p1.add(b4);
        p.add(p1);
        j.add(p);
        j.setVisible(true);
    }

    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == b1) {
            str = "src/election.txt";
            new Delete(str);
        } else if (e.getSource() == b2) {
            
            
            new WriteLog();
            new Log();
        } else if (e.getSource() == b3) {
            str = "src/people.txt";
            new Delete(str);
        } else if (e.getSource() == b4) {
            try {
                new Receive();
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    }

}


